"""
页面类
"""
from selenium.webdriver.common.by import By  # 引入By类
from pages.base_page import BasePage  # 引入页面基类


# 定义一个登录页面类，继承页面基类
class LoginCrmPage(BasePage):
    # 定位器
    # url = 'http://192.168.1.199/crm'
    username_locator = (By.NAME, 'name')
    password_locator = (By.NAME, 'password')
    login_locator = (By.NAME, 'submit')

    # 操作
    # 输入用户名
    def input_username(self, username):
        self.driver.find_element(*self.username_locator).send_keys(username)

    # 输入密码
    def input_password(self, password):
        self.driver.find_element(*self.password_locator).send_keys(password)

    # 点击登录
    def click_login(self):
        self.driver.find_element(*self.login_locator).click()
